<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
    <title>我的购物车</title>
    <link rel="icon" href="/img/favicon.ico">

    <link rel="stylesheet" type="text/css" href="/css/all.css"/>
    <link rel="stylesheet" type="text/css" href="/css/pages-cart.css"/>
    <script src="/js/jquery-3.4.1.js"></script>
</head>

<body>
<!--head-->
<!-- 头部栏位 -->
<!--页面顶部-->
<div id="nav-bottom" th:insert="index-nav::index-nav">
    <!--顶部-->
</div>


<div class="cart py-container">
    <!--All goods-->
    <div class="allgoods">
        <h4>全部商品<span></span></h4>
        <div class="cart-main">
            <div class="yui3-g cart-th">
                <div class="yui3-u-1-4"><input class="chooseAll" type="checkbox" onclick="checkAll()" id="checkAll"/> 全部
                </div>
                <div class="yui3-u-1-4">商品</div>
                <div class="yui3-u-1-8">单价（元）</div>
                <div class="yui3-u-1-8">数量</div>
                <div class="yui3-u-1-8">小计（元）</div>
                <div class="yui3-u-1-8">操作</div>
            </div>
			<form method="post" name="frm" action="/cartBuy">
            <div class="cart-item-list">
                <div class="cart-body">
                    <div class="cart-list">
                        <ul class="goods-list yui3-g" th:each="cart:${cartList}">
                            <li class="yui3-u-1-24">
                                <input type="checkbox" name="id" th:value="${cart.id}" />
                            </li>
                            <li class="yui3-u-6-24">
                                <div class="good-item">
                                    <div class="item-img"><img th:src="${cart.img}"/></div>
                                    <div class="item-msg" th:text="${cart.name}"></div>
                                </div>
                            </li>
                            <li class="yui3-u-5-24">

                            </li>
                            <li class="yui3-u-1-8"><span class="price" th:text="${cart.price}"></span>
                                <input type="hidden" th:id="'hprice'+${cart.id}" th:value="${cart.price}">
                            </li>
                            <li class="yui3-u-1-8">
                                <a th:href="'javascript:sub(\'' +${cart.id}+'\')'" class="increment mins">-</a>
                                <input autocomplete="off" th:id="'num'+${cart.id}" type="text" name="num"
                                       th:value="${cart.num}"
                                       minnum="1" class="itxt"/>
                                <a th:href="'javascript:add(\'' +${cart.id}+'\')'" class="increment plus">+</a>
                            </li>
                            <li class="yui3-u-1-8"><span class="sum" th:id="'sum'+${cart.id}"></span></li>
                            <li class="yui3-u-1-8">
                                <a th:href="'/cart/del?id='+${cart.id}">删除</a><br/>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="cart-tool">
            <input type="submit" value="结算" class="sumbtn sum-btn">
        </div>
		</form>
        <div class="clearfix"></div>
    </div>
</div>
<!-- 底部栏位 -->
<!--页面底部-->
<div class="clearfix footer">
    <div class="py-container">
        <div class="footlink">
            <div class="Mod-service">
                <ul class="Mod-Service-list">
                    <li class="grid-service-item intro  intro1">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                    <li class="grid-service-item  intro intro2">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                    <li class="grid-service-item intro  intro3">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                    <li class="grid-service-item  intro intro4">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                    <li class="grid-service-item intro intro5">

                        <i class="serivce-item fl"></i>
                        <div class="service-text">
                            <h4>正品保障</h4>
                            <p>正品保障，提供发票</p>
                        </div>

                    </li>
                </ul>
            </div>
            <div class="clearfix Mod-list">
                <div class="yui3-g">
                    <div class="yui3-u-1-6">
                        <h4>购物指南</h4>
                        <ul class="unstyled">
                            <li>购物流程</li>
                            <li>会员介绍</li>
                            <li>生活旅行/团购</li>
                            <li>常见问题</li>
                            <li>购物指南</li>
                        </ul>

                    </div>
                    <div class="yui3-u-1-6">
                        <h4>配送方式</h4>
                        <ul class="unstyled">
                            <li>上门自提</li>
                            <li>211限时达</li>
                            <li>配送服务查询</li>
                            <li>配送费收取标准</li>
                            <li>海外配送</li>
                        </ul>
                    </div>
                    <div class="yui3-u-1-6">
                        <h4>支付方式</h4>
                        <ul class="unstyled">
                            <li>货到付款</li>
                            <li>在线支付</li>
                            <li>分期付款</li>
                            <li>邮局汇款</li>
                            <li>公司转账</li>
                        </ul>
                    </div>
                    <div class="yui3-u-1-6">
                        <h4>售后服务</h4>
                        <ul class="unstyled">
                            <li>售后政策</li>
                            <li>价格保护</li>
                            <li>退款说明</li>
                            <li>返修/退换货</li>
                            <li>取消订单</li>
                        </ul>
                    </div>
                    <div class="yui3-u-1-6">
                        <h4>特色服务</h4>
                        <ul class="unstyled">
                            <li>夺宝岛</li>
                            <li>DIY装机</li>
                            <li>延保服务</li>
                            <li>品优购E卡</li>
                            <li>品优购通信</li>
                        </ul>
                    </div>
                    <div class="yui3-u-1-6">
                        <h4>帮助中心</h4>
                        <img src="./img/wx_cz.jpg">
                    </div>
                </div>
            </div>
            <div class="Mod-copyright">
                <ul class="helpLink">
                    <li>关于我们<span class="space"></span></li>
                    <li>联系我们<span class="space"></span></li>
                    <li>关于我们<span class="space"></span></li>
                    <li>商家入驻<span class="space"></span></li>
                    <li>营销中心<span class="space"></span></li>
                    <li>友情链接<span class="space"></span></li>
                    <li>关于我们<span class="space"></span></li>
                    <li>营销中心<span class="space"></span></li>
                    <li>友情链接<span class="space"></span></li>
                    <li>关于我们</li>
                </ul>
            </div>
        </div>
    </div>
</div>
<!--页面底部END-->
<script type="text/javascript">
    function checkAll() {
        $("input[name='id']").prop("checked", $("#checkAll").checked);
    }

    function add(i) {
        $("#num" + i).val(1 + parseInt($("#num" + i).val()))

        $("#sum" + i).html((parseFloat($("#hprice" + i).val()) * parseInt($("#num" + i).val())).toFixed(2))
    }

    function sub(i) {
        if ($("#num" + i).val() <= 1) {
            return
        } else {
            $("#num" + i).val(parseInt($("#num" + i).val()) - 1)
            $("#sum" + i).html((parseFloat($("#hprice" + i).val()) * parseInt($("#num" + i).val())).toFixed(2))
        }
    }

    function doSubmit() {
		frm.submit()
	}
</script>

</body>

</html>